#-*- coding:utf-8 -*-
"""
this script preset the maya data on persp camera
"""
import os
import sys
#reload(sys)
#sys.setdefaultencoding('utf-8')
import json
import pymel.core as pm
import inspect

file_path=inspect.getfile(lambda :None)
dir_path = os.path.dirname(file_path)
presets_path = os.path.join(dir_path,'config','presets.json')


def perset():
    # with open(r'D:/presets_path.txt','w') as w:
        # w.write(presets_path)
    data = {}
    with open(presets_path,'r') as r:
        da = r.read()
        data = json.loads(da)

    persp = pm.ls('persp')[0]

    persp.addAttr('driver',dt='string')
    persp.setAttr('driver',data['driver'])
    persp.addAttr('full_name',dt='string')
    persp.setAttr('full_name',data['full_name'])
    persp.addAttr('entity_name',dt='string')
    persp.setAttr('entity_name',data['entity_name'])
    persp.addAttr('module',dt='string')
    persp.setAttr('module',data['module'])
    persp.addAttr('pipeline',dt='string')
    persp.setAttr('pipeline',data['pipeline'])
    persp.addAttr('eps',dt='string')
    persp.setAttr('eps',data['eps'])
    persp.addAttr('asset_shot',dt='string')
    persp.setAttr('asset_shot',data['asset_shot'])
    persp.addAttr('frame',at='long')
    persp.setAttr('frame',data['frame'])
    persp.addAttr('fps',at='long')
    persp.setAttr('fps',data['fps'])
    persp.addAttr('resolution',dt='string')
    persp.setAttr('resolution',data['resolution'])
    persp.addAttr('path',dt='string')
    persp.setAttr('path',data['path'])
    persp.addAttr('cg_id',dt='string')
    persp.setAttr('cg_id',data['cg_id'])
    persp.addAttr('database',dt='string')
    persp.setAttr('database',data['database'])
    persp.addAttr('description',dt='string')
    persp.setAttr('description',data['description'])



if __name__ == '__main__':
    perset()











